<html>
<head>
<title>
Image - Helma Javascript Reference
</title>

<meta http-equiv="Content-Script-Type" content="text/javascript">
<script src="scripts.js"></script>
<link rel="stylesheet" href="styles.css" media="screen" />
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
    <script type="text/javascript">_uacct = "UA-737027-2";urchinTracker();</script>
<style>
td {
    font-family: "Trebuchet MS", sans-serif; 
    font-size: 13px; 
    line-height:135%;
}
.columnheight {
    height: 1350px;
}
</style>
</head>
<body bgcolor="white">

<div class="frame">

<img class="home" onclick="location='http://dev.helma.org/'" src="helmaheader.gif" /><br />
<div class="lead">
    <p>Detailed reference of prototypes, properties and methods available in the <br />
    Javascript environment of your Helma web applications.</p>
</div>

<script> openbox('content') </script>


    <div class="content">
        <div class="docs">
        
            <!--
            <div class="sectionHead">Library: Image.js</div>
            -->
            <div class="section overview">
            <!--
                <div class="itemTitle">
                    Overview
                </div>
            -->
                <div>   
                    <div class="desc">Default properties and methods of  
the Image prototype.</div>
                    <div class="itemTags">
            <!--
                    <ul>
                        
                    
                    </ul>
            -->
                    </div>
                </div>
            </div>
            
            <!--
            <div class="sectionHead">Constructors</div>
            -->
            
            
            <div class="section constructor">
                <div class="itemTitle">
                    <a name="Image"></a>
                    
                    
                    
                        <i><span class="symbolname">Image</span>(<span class="signature">img</span>)</i>
                    
                    
                </div>
                
                
                    <div class="desc">Helma's built-in image object allows you to read, manipulate, and save images.
<br /><br />
An image object is created using the Image() constructor.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/image.gif");</pre></div>
                
                
                
                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            String
                        </td>
                        <td>
                            img
                        </td>
                        <td>
                            as String of a URL, or a java.io.InputStream object
                        </td> 
                    </tr>
                
                </table>
                
                
                
                <div class="detailHead">methods</div>
                
                    <ul class="details">
                        <li><a href="#Image.crop">crop</a>(x, y, width, height)</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.dispose">dispose</a>()</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.drawLine">drawLine</a>(xStart, yStart, xEnd, yEnd)</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.drawRect">drawRect</a>(x, y, width, height)</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.fillRect">fillRect</a>(x, y, width, height)</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.getHeight">getHeight</a>()</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.getInfo">getInfo</a>(pathOfImage)</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.getSource">getSource</a>()</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.getWidth">getWidth</a>()</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.reduceColors">reduceColors</a>(colorDepth, dither, alphaToBitmask)</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.resize">resize</a>(width, height)</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.resizeFast">resizeFast</a>(width, height)</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.setColor">setColor</a>(red, green, blue)</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.setFont">setFont</a>(name, style, size)</li>
                    </ul>
                
                    <ul class="details">
                        <li><a href="#Image.setTransparentPixel">setTransparentPixel</a>(index)</li>
                    </ul>
                
                
                
                
                
                
                
                

                

            </div>
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            <!--
            <div class="sectionHead">Namespaces</div>
            -->
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            <!--
            <div class="sectionHead">Properties</div>
            -->
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            

            <!--
            <div class="sectionHead">Constructors</div>
            -->
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            <div class="sectionHead">Methods</div>
            
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.crop"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">crop</span>(<span class="signature">x, y, width, height</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Cuts out (crops) a rectanglular area of an image.
<br /><br />
The dimensions of the area are calculated from the 
xNumber- and yNumber-offsets (ie. from the top left 
corner of the image as upper left reference point) 
to xNumber + widthNumber and yNumber + heightNumber 
as lower right reference point.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/original.gif");
res.write('&lt:img src="/images/original.gif" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/hopcropanim.gif" />
&nbsp;
img.crop(58, 9, 48, 21);
img.saveAs("/www/images/processed.gif");
res.write('&lt;img src="/images/processed.gif" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/crop.gif" /></pre></div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            x
                        </td>
                        <td>
                            as Number, offset from the top left corner of the image
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            y
                        </td>
                        <td>
                            as Number, offset from the lower right corner of image
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            width
                        </td>
                        <td>
                            as Number, the width of the image
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            height
                        </td>
                        <td>
                            as Number, the height of the image
                        </td> 
                    </tr>
                
                </table>
                
                
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.dispose"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">dispose</span>(<span class="signature"></span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Disposes an Image object that is no longer needed. 
<br /><br />
If an instance of java.awt.Graphics has been allocated 
for the Image, the dispose() method is called on it to 
free its resources.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/original.jpg");
// do something useful or funny with the image
img.dispose();</pre></div>
                

                
                
                
                
                
                
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.drawLine"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">drawLine</span>(<span class="signature">xStart, yStart, xEnd, yEnd</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Draws a line onto an image.
<br /><br />
The line starts at the reference point defined by the offsets
x1Number and y1Number from the top left corner of the image 
and ends at the reference point defined by the offsets x2Number
and y2Number.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/original.gif");
res.write('&lt;img src="/images/original.gif" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/helmalogo.gif" />
&nbsp;
img.setColor(204, 0, 0);
img.drawLine(58, 26, 100, 26);
img.saveAs("/www/images/processed.gif");
res.write('&lt;img src="/images/processed.gif" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/drawline.gif" /></div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            xStart
                        </td>
                        <td>
                            as Number, horizontal reference point from top left corner of the image
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            yStart
                        </td>
                        <td>
                            as Number, vertical reference point from top left corner of the image
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            xEnd
                        </td>
                        <td>
                            as Number, horizontal reference point where the line ends in the image
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            yEnd
                        </td>
                        <td>
                            as Number, vertical reference point where the line ends in the image
                        </td> 
                    </tr>
                
                </table>
                
                
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.drawRect"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">drawRect</span>(<span class="signature">x, y, width, height</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Draws a rectangle onto an image.
<br /><br />
The rectangle's dimensions are calculated from the 
xNumber- and yNumber-offset (ie. from the top left 
corner of the image as upper left reference point) 
to xNumber + widthNumber and yNumber + heightNumber 
as lower right reference point.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/originalgif");
res.write('&lt;img src="/images/original.gif" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/helmalogo.gif" />
&nbsp;
img.setColor(204, 0, 0);
img.drawRect(57, 8, 46, 20);
img.saveAs("/www/images/processed.gif");
res.write('&lt;img src="/images/processed.gif" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/drawrect.gif" /></div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            x
                        </td>
                        <td>
                            as Number, as upper left reference point.
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            y
                        </td>
                        <td>
                            as Number, as the lower right reference point upperleft
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            width
                        </td>
                        <td>
                            as Number, width of the crop
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            height
                        </td>
                        <td>
                            as Number, height of the crop
                        </td> 
                    </tr>
                
                </table>
                
                
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.prototye.drawString"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">prototye.drawString</span>(<span class="signature">textToDraw, x, y</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Draws text onto an image.
<br /><br />
The string will be drawn starting at the xNumber- 
and yNumber-offset from the top left corner of the image.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/original.gif");
res.write('&lt;img src="/images/original.gif" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/helmalogo.gif' />
&nbsp;
img.setColor(204, 0, 0);
img.drawString("rocks!", 82, 35);
img.saveAs("/www/images/processed.gif");
res.write('&lt;img src="/images/processed.gif" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/drawstring.gif" /></div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            String
                        </td>
                        <td>
                            textToDraw
                        </td>
                        <td>
                            as String, the string to be drawn on the image.
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            x
                        </td>
                        <td>
                            as Number, horizontal offset from the top left corner of the image.
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            y
                        </td>
                        <td>
                            as Number, vertical offset from the top left corner of the image.
                        </td> 
                    </tr>
                
                </table>
                
                
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.fillRect"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">fillRect</span>(<span class="signature">x, y, width, height</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Draws a filled rectangle onto an image.
<br /><br />
The rectangle's dimensions are calculated from the 
xNumber- and yNumber-offset (ie. from the top left 
corner of the image as upper left reference point) 
to xNumber + widthNumber and yNumber + heightNumber 
as lower right reference point.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/original.gif");
res.write('&lt;img src="/images/original.gif" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/helmalogo.gif" />
&nbsp;
img.setColor(204, 0, 0);
img.fillRect(58, 27, 43, 29);
img.saveAs("/www/images/processed.gif");
res.write('&lt;img src="/images/processed.gif" /&gt;');
&nbsp;
</pre><img src="http://helma.org/static/images/helma/fillrect.gif" /></div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            x
                        </td>
                        <td>
                            as Number, from the top left corner of the image.
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            y
                        </td>
                        <td>
                            as Number, from the lower reference point.
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            width
                        </td>
                        <td>
                            as Number, width of the rectangle
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            height
                        </td>
                        <td>
                            as Number, height of the rectangle
                        </td> 
                    </tr>
                
                </table>
                
                
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.getHeight"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">getHeight</span>(<span class="signature"></span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Returns the height of an image measured in pixels.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/hop.gif");
res.write('&lt;img src="/images/hop.gif" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/helmalogo.gif" />
&nbsp;
var height = img.getHeight();
res.write(height);
<i>35</i></pre></div>
                

                
                
                
                
                
                
                
                <div class="detailHead">returns</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            
                        </td>
                        <td>
                            Number
                        </td> 
                    </tr>
                
                </table>
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.getInfo"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">getInfo</span>(<span class="signature">pathOfImage</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Returns an ImageInfo object for an image.
<br /><br />
This function allows to retrieve image properties 
such as width, height and MIME type without the need 
to fully decode the image.
<br /><br />
Example:
&nbsp;
<pre>var info = Image.getInfo("http://helma.org/images/hop.gif");
if (info) {
&nbsp;&nbsp;res.writeln('width: ' + info.width);
&nbsp;&nbsp;res.writeln('height: ' + info.height);
}
&nbsp;
<i>width: 174
height: 35</i>
<br /><br />
Note that in contrast to the other Image function, this is called on the 
constructor rather than on a decoded Image object. This is because the 
purpose of this function is to avoid the expensive image decoding 
process if we're just interested in some of the image's properties.
<br /><br />
The function returns an instance of Marco Schmidt's ImageInfo object 
if the image could be read, or null if the image couldn't be read. 
See the ImageInfo API documentation for the full set of methods. 
(Remember that you can getters as properties in Rhino as shown in the example above.)</div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            String
                        </td>
                        <td>
                            pathOfImage
                        </td>
                        <td>
                            as String, it can be a path, url, byteArray or inputstream.
                        </td> 
                    </tr>
                
                </table>
                
                
                
                <div class="detailHead">returns</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            
                        </td>
                        <td>
                            ImageInfo
                        </td> 
                    </tr>
                
                </table>
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.getSource"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">getSource</span>(<span class="signature"></span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Retrieves a Java-compatible image object from a Helma image object.
<br /><br />
To use some of the image filters provided by the JIMI Java image 
processing package com.sun.jimi.core.filters, a specific Java 
class of image objects is needed.
<br /><br />
Helma wraps the sun.awt.image objects into a custom class. 
To use Helma image objects with JIMI's filters these have to be 
"unwrapped" using the getSource() function.
<br /><br />
<b>The following filter functions have been successfully applied the way as described in the examples below:</b>
<pre>&nbsp;&nbsp;* Rotate(degreeNumber)
&nbsp;&nbsp;* Gray()
&nbsp;&nbsp;* Flip(typeNumber)
&nbsp;&nbsp;* Oil(intensityNumber)
&nbsp;&nbsp;* Invert()
&nbsp;&nbsp;* Smooth(intensityNumber)
&nbsp;&nbsp;* Shear(degreeNumber)
&nbsp;&nbsp;* Edges()
&nbsp;&nbsp;* Shrink(multiplyNumber)
&nbsp;&nbsp;* Enlarge(divisionNumber)</pre>
<br /><br />
Please take into account that the quality might suffer depending on the type 
and amount of filters applied to the image.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/static/original.jpg");
var filters = Packages.com.sun.jimi.core.filters;
var rotator = new filters.Rotate(45);
var processed = new Image(img, rotator);
processed.saveAs("/path/to/static/processed.jpg");
res.write('&lt;img src="/static/processed.jpg" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/rotated45.jpg" />
&nbsp;
var oil = new filters.Oil(img.getSource(), 3);
var processed = new Image(img, oil);
processed.saveAs("/path/to/static/processed.jpg");
res.write('&lt;img src="/static/processed.jpg" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/oilfiltered.jpg" /></div>
                

                
                
                
                
                
                
                
                <div class="detailHead">returns</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            
                        </td>
                        <td>
                            Packages.com.sun.awt.image
                        </td> 
                    </tr>
                
                </table>
                
                
                

                
                <div class="detailHead">see</div>
                <table class="params">
                
                    <tr><td class="type"><div class="see"><a href="http://google.com/search?q=com.sun.awt.image">Packages.com.sun.awt.image</a></div></td></tr>
                
                </table>
                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.getWidth"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">getWidth</span>(<span class="signature"></span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Returns the width of an image measured in pixels.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/hop.gif");
res.write('&lt;img src="/images/hop.gif" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/helmalogo.gif" />
&nbsp;
var width = img.getWidth();
res.write(width);
<i>174</i></pre></div>
                

                
                
                
                
                
                
                
                <div class="detailHead">returns</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            
                        </td>
                        <td>
                            Number
                        </td> 
                    </tr>
                
                </table>
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.reduceColors"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">reduceColors</span>(<span class="signature">colorDepth, dither, alphaToBitmask</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Reduces the number of available colors (color depth) in an image.
<br /><br />
Note: GIF images need a color depth of 256 colors maximum. Use this function with caution, generally.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/original.jpg");
res.write('&lt;img src="/images/original.jpg" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/hawatosch.jpg" />
&nbsp;
img.reduceColors(8);
img.saveAs("/www/images/processed.jpg");
res.write('&lt;img src="/images/processed.jpg" /&gt;');</pre>
<img src="http://helma.org/static/images/helma/reducedcolors.jpg" /></div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            colorDepth
                        </td>
                        <td>
                            as Number, value of color depth in an image.
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            dither
                        </td>
                        <td>
                            as Boolean, optional parameter to enable dithering
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            alphaToBitmask
                        </td>
                        <td>
                            as Boolean, optional parameter to use the alpha channel to create a bitmask
                        </td> 
                    </tr>
                
                </table>
                
                
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.resize"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">resize</span>(<span class="signature">width, height</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Sets the height and width of an image to new values.
<br /><br />
The widthNumber and heightNumber arguments need to be integers, 
so be careful to round the new values eventually.
<br /><br />
In case of a GIF image always reduce the image to 256 colors after resizing 
by using the reduceColors() function.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/original.jpg");
res.write('&ltimg src="/images/original.jpg" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/hawatosch.jpg" />
&nbsp;
var factor = 0.66;
var wd = Math.round(img.getWidth() * factor);
var ht = Math.round(img.getHeight() * factor);
img.resize(wd, ht);
img.saveAs("/www/images/processed.jpg");
&nbsp;
<i>res.write('&lt;img src="/images/processed.jpg" /&gt;');</i></pre>
<img src="http://helma.org/static/images/helma/hawatosch.jpg" /></div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            width
                        </td>
                        <td>
                            as Number, new width of the image.
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            height
                        </td>
                        <td>
                            as Number, new height of the image.
                        </td> 
                    </tr>
                
                </table>
                
                
                
                
                

                
                <div class="detailHead">see</div>
                <table class="params">
                
                    <tr><td class="type"><div class="see"><a href="Image.html#Image.resizeFast">Image.resizeFast</a></div></td></tr>
                
                </table>
                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.resizeFast"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">resizeFast</span>(<span class="signature">width, height</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Resizes the image, using a fast and cheap algorithm.</div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            width
                        </td>
                        <td>
                            as Number, new width of the image.
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            height
                        </td>
                        <td>
                            as Number, new height of the image.
                        </td> 
                    </tr>
                
                </table>
                
                
                
                
                

                
                <div class="detailHead">see</div>
                <table class="params">
                
                    <tr><td class="type"><div class="see"><a href="Image.html#Image.resize">Image.resize</a></div></td></tr>
                
                </table>
                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.setColor"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">setColor</span>(<span class="signature">red, green, blue</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Sets the color for current drawing actions.
<br /><br />
The colorNumber argument is represented by a 24-bit integer (0-16777215), 
the redNumber, greenNumber and blueNumber arguments build an RGB 
tuple with each element ranging from 0 to 255.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/original.jpg");
res.write('&lt;img src="/images/original.jpg" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/hawatosch.jpg" />
&nbsp;
img.setColor(16777215);
img.fillRect(80, 50, 30, 30);
img.setColor(255, 255, 0);
img.fillRect(65, 15, 30, 30);
img.saveAs("/www/images/processed.jpg");
res.write('&lt;img src="/images/processed.jpg" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/setcolor.jpg" /></div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            red
                        </td>
                        <td>
                            as Number, RGB value ranging from 0 to 255 or if it the only parameter then it can be a 24 bit Integer
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            green
                        </td>
                        <td>
                            as Number, RGB value ranging from 0 to 255
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            blue
                        </td>
                        <td>
                            as Number, RGB value ranging from 0 to 255.
                        </td> 
                    </tr>
                
                </table>
                
                
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.setFont"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">setFont</span>(<span class="signature">name, style, size</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Determines the typeface font to be used in current drawing actions.
<br /><br />
Using this function sets the font to be used in subsequent calls of the drawString() function.
<br /><br />
The nameString argument specifies the font face as string (e.g. "sansserif", "dialog").
<br /><br />
The integer styleNumber sets the font to normal (0), bold (1), italic (2) or bold and italic (3).
<br /><br />
The sizeNumber, an integer as well, refers to the font size in pixels.
<br /><br />
Please take a look at the description about adding fonts to the Java runtime 
for a detailed look onto Java's font mechanics.
<br /><br />
Example:
<pre>var img = new Image("http://helma.org/images/original.jpg");
res.write('&lt;img src="/images/original.jpg" /&gt;');
&nbsp;
<img src="http://helma.org/static/images/helma/hawatosch.jpg" />
&nbsp;
img.setColor(255, 255, 255);
img.setFont("serif", 0, 12);
img.drawString("I shot the serif.", 50, 15);
img.setFont("sansserif", 1, 14);
img.drawString("But I didn't shoot", 10, 100);
img.setFont("monospaced", 2, 16);
img.drawString("the monotype.", 15, 115);
img.saveAs("/www/images/processed.png");
res.write('&lt;img src="/images/processed.png" /&gt;');</pre>
<img src="http://helma.org/static/images/helma/setfont.jpg" /></div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            String
                        </td>
                        <td>
                            name
                        </td>
                        <td>
                            as String, specifies the font face (e.g. "sansserif").
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            style
                        </td>
                        <td>
                            as Number, the styleNumber normal (0), bold (1), italic (2) or bold and italic (3).
                        </td> 
                    </tr>
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            size
                        </td>
                        <td>
                            as Number, refers to font size in pixels
                        </td> 
                    </tr>
                
                </table>
                
                
                
                
                

                

            </div>
            
            
            
            <div class="section function">
                <div class="itemTitle">
                    <a name="Image.setTransparentPixel"></a>
                    
                    
                        <i><a href="#Image" class="type">Image</a>.
                        <span class="symbolname">setTransparentPixel</span>(<span class="signature">index</span>)</i>
                    
                    
                    
                </div>
                
                
                    <div class="desc">Sets the palette index of the transparent color for Images with an IndexColorModel.

This can be used together with an Image's getPixel method.</div>
                

                
                
                
                
                
                <div class="detailHead">parameters</div>
                <table class="params">
                
                    <tr>
                        <td class="type">
                            Number
                        </td>
                        <td>
                            index
                        </td>
                        <td>
                            as Number, the index position specifying the transparent color.
                        </td> 
                    </tr>
                
                </table>
                
                
                
                
                

                
                <div class="detailHead">see</div>
                <table class="params">
                
                    <tr><td class="type"><div class="see"><a href="Image.html#Image.getPixel">Image.getPixel</a></div></td></tr>
                
                </table>
                

            </div>
            
            
            
        </div>
    </div>
    <div class="finePrint">
    Fri, 05 Feb 2010 17:40:04 GMT.
    </div>

<script> closebox() </script>

<script> openbox('pageintro') </script>

    <h3>core framework</h3>
        <ul>            
            <li><a href="global.html">global</a></li>
            <li><a href="app.html">app (application)</a></li>
            <li><a href="req.html">req (request)</a></li>
            <li><a href="res.html">res (response)</a></li>
            <li><a href="session.html">session</a></li>
            <li><a href="global.html#path">path</a></li>
            <li><a href="global.html#root">root</a></li>
            <li><a href="HopObject.html">HopObject</a></li>
            <li><a href="User.html">User</a></li>
            <li><a href="File.html">File</a></li>
            <li><a href="FtpClient.html">FtpClient</a></li>
            <li><a href="Image.html">Image</a></li>
            <li><a href="Mail.html">Mail</a></li>
            <li><a href="global.html#Remote">Remote</a></li>
            <li><a href="Xml.html">Xml</a></li>
            <li><a href="DatabaseObject.html">DatabaseObject</a></li>
            <li><a href="MimePart.html">MimePart</a></li>
            <li><a href="Skin.html">Skin</a></li>
            <li><a href="global.html#Object.dontEnum">Object</a></li>
        </ul>
        
    <h3>optional modules</h3>
        <ul>            
            <li><a href="ArrayExtensions.html">Array extensions</a></li>
            <li><a href="DateExtensions.html">Date extensions</a></li>
            <li><a href="NumberExtensions.html">Number extensions</a></li>
            <li><a href="ObjectExtensions.html">Object extensions</a></li>
            <li><a href="StringExtensions.html">String extensions</a></li>
            <li><a href="HopObjectExtensions.html">HopObject extensions</a></li>
            <li><a href="GlobalMacros.html">global macros</a></li>
            <li><a href="MacroFilters.html">macro filters</a></li>
            <li><a href="JSON.html">JSON methods</a></li>
            <br />
            <li><a href="helma.Aspects.html">helma.Aspects</a></li>
            <li><a href="helma.Chart.html">helma.Chart</a></li>
            <li><a href="helma.Color.html">helma.Color</a></li>
            <li><a href="helma.Database.html">helma.Database</a></li>
            <li><a href="helma.File.html">helma.File</a></li>
            <li><a href="helma.Ftp.html">helma.Ftp</a></li>
            <li><a href="helma.Group.html">helma.Group</a></li>
            <li><a href="helma.Html.html">helma.Html</a></li>
            <li><a href="helma.Http.html">helma.Http</a></li>
            <li><a href="helma.Image.html">helma.Image</a></li>
            <li><a href="helma.Mail.html">helma.Mail</a></li>
            <li><a href="helma.Search.html">helma.Search</a></li>
            <li><a href="helma.Skin.html">helma.Skin</a></li>
            <li><a href="helma.Ssh.html">helma.Ssh</a></li>
            <li><a href="helma.Url.html">helma.Url</a></li>
            <li><a href="helma.Zip.html">helma.Zip</a></li>
            <br />
            <li><a href="jala.BitTorrent.html">jala.BitTorrent</a></li>
            <li><a href="jala.Captcha.html">jala.Captcha</a></li>
            <li><a href="jala.Date.html">jala.Date</a></li>
            <li><a href="jala.db.html">jala.db</a></li>
            <li><a href="jala.DnsClient.html">jala.DnsClient</a></li>
            <li><a href="jala.Form.html">jala.Form</a></li>
            <li><a href="jala.History.html">jala.History</a></li>
            <li><a href="jala.HopObjectExtensions.html">jala HopObject extensions</a></li>
            <li><a href="jala.HtmlDocument.html">jala.HtmlDocument</a></li>
            <li><a href="jala.I18n.html">jala.I18n</a></li>
            <li><a href="jala.ImageFilter.html">jala.ImageFilter</a></li>
            <li><a href="jala.IndexManager.html">jala.IndexManager</a></li>
            <li><a href="jala.ListRenderer.html">jala.ListRenderer</a></li>
            <li><a href="jala.Mp3.html">jala.Mp3</a></li>
            <li><a href="jala.PodcastWriter.html">jala.PodcastWriter</a></li>
            <li><a href="jala.RemoteContent.html">jala.RemoteContent</a></li>
            <li><a href="jala.Rss20Writer.html">jala.Rss20Writer</a></li>
            <li><a href="jala.Utilities.html">jala.Utilities</a></li>
            <li><a href="jala.XmlRpcRequest.html">jala.XmlRpcRequest</a></li>
            <li><a href="jala.XmlWriter.html">jala.XmlWriter</a></li>
        </ul>
    
    <h3>java libraries</h3>
        <ul>            
            <li><a href="http://www.docjar.org/">docjar search</a></li>
        </ul>

    <h3>properties files</h3>
        <ul>            
            <li><a href="http://dev.helma.org/docs/Properties+Files/apps.properties/">apps.properties</a></li>
            <li><a href="http://dev.helma.org/docs/Properties+Files/app.properties/">app.properties</a></li>
            <li><a href="http://dev.helma.org/docs/Properties+Files/server.properties/">server.properties</a></li>
            <li><a href="http://dev.helma.org/docs/Properties+Files/db.properties/">db.properties</a></li>
            <li><a href="http://dev.helma.org/docs/Properties+Files/class.properties/">class.properties</a></li>
            <li><a href="http://dev.helma.org/docs/Type.properties+Documentation/">type.properties</a></li>
         </ul>
    
<script> closebox() </script>

</div>
<br clear="all" /><br /><br />



</body>
</html>
